//
//  BlueToothManager.h
//  zhongdaodianziApp
//
//  Created by chinadfwx on 2018/9/15.
//  Copyright © 2018年 zhongDaoDianZi. All rights reserved.
//

#import <Foundation/Foundation.h>
//#import "ZDBlueListView.h"
//#import <Masonry.h>
#import "CalculateTool.h"
#import <CoreBluetooth/CoreBluetooth.h>

@protocol BlueToothManagerDelegate<NSObject>
/**
 **发现特征
 */
-(void)BlueToothManagerDiscoverCharateristicsWithPeripheral:(CBPeripheral *)peripheral withService:(CBService *)service error:(NSError *)error;
/**
 **设备断开
 */
-(void)blueToothManagerDisConnectedCentral:(CBCentralManager *)central peripheral:(CBPeripheral *)peripheral error:(NSError *)error;
/**
 **接收数据
 */
-(void)blueToothManagerGetDataFromUpdateValue:(CBPeripheral *)peripheral UTF8String:(NSString *)string characteristic:(CBCharacteristic *)characteristic error:(NSError *)error;
/**
 **设备连接成功
 */
-(void)blueToothManagerConnectedCentral:(CBCentralManager *)central DidConnectedPeripheral:(CBPeripheral *)peripheral;
/*
 *扫描设备
 */
-(void)BlueToothManagerScanDevice;
/*
 *cancle扫描设备
 */
-(void)BlueToothManagerCancleScanDevice;
/*
 *定时执行
 **/
-(void)BlueToothManagerTimingIsRuning;


@end

@interface BlueToothManager : NSObject
//@property (nonatomic, strong) CBCentralManager *manager;
@property (nonatomic, strong) CBCentralManager *centerManager;
@property (nonatomic, strong) CBPeripheral *peripheral;
@property (nonatomic, strong) NSMutableArray *peripheralArray;
@property (nonatomic, strong) CBCharacteristic *characteristic;
@property (nonatomic, assign) id <BlueToothManagerDelegate>delegate;
@property (nonatomic, strong) NSTimer *seconds_timer;
@property (nonatomic, strong) NSArray *eqDataArray;
@property (nonatomic, strong) NSString *password;


+ (instancetype)shareInstance;
-(void)centerManagerScanDevice;
-(void)centerManagerCancleScanDevice;
-(void)sendDataWithCommand:(NSString *)command;
-(void)sendDataWithCommandWithOutResponse:(NSString *)command;

@end
